package org.jeecg.modules.mes.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mes.entity.MesEmployeeWorkType;

import java.util.List;
import java.util.Map;

/**
 * 员工工种关联表 Mapper 接口
 */
public interface MesEmployeeWorkTypeMapper extends BaseMapper<MesEmployeeWorkType> {

    /**
     * 分页查询员工工种分配列表
     */
    IPage<MesEmployeeWorkType> queryPageList(Page<MesEmployeeWorkType> page, @Param("params") Map<String, Object> params);

    /**
     * 根据员工ID查询工种列表
     */
    List<MesEmployeeWorkType> selectByEmployeeId(@Param("employeeId") String employeeId);

    /**
     * 根据工种ID查询员工列表
     */
    List<MesEmployeeWorkType> selectByWorkTypeId(@Param("workTypeId") String workTypeId);

    /**
     * 检查员工工种分配是否存在
     */
    int checkEmployeeWorkTypeExists(@Param("employeeId") String employeeId, 
                                   @Param("workTypeId") String workTypeId, 
                                   @Param("excludeId") String excludeId);

    /**
     * 批量删除员工工种分配
     */
    int deleteBatchByEmployeeId(@Param("employeeId") String employeeId);

    /**
     * 批量删除工种相关的员工分配
     */
    int deleteBatchByWorkTypeId(@Param("workTypeId") String workTypeId);
}
